#pragma once
#include "graphics/idevice.h"
#include "d3d_inc.h"
#include "client/windows/window.h"
#include "d3dtexture.h"

/*
 * https://msdn.microsoft.com/en-us/library/windows/desktop/ff476880(v=vs.85).aspx
 *
 * A device is used to create resources and to enumerate the capabilities of a display adapter.
 * Each Application must have at least one device, most applications only create one device. Create a device for one of the hardware drivers installed
 * on your machine by calling D3D11CreateDevice or D3D11CreateDeviceAndSwapChain and specify the driver type with the D3D_DRIVER_TYPE flag. Each device can use
 * one or more device context, depending on the functionality desired.
 *
 * A device context contains the circumstance or setting in which a device is used. More specifically, a device context is used to set pipeline state and generate
 * rendering commands using the resources owned by a device.
 *
 */

namespace renderit {
	namespace graphics {

		class d3ddevice : public idevice
		{
		public:
			d3ddevice(client::iwindow * w);
			~d3ddevice() {} // TODO: release

		public:
			ishader * create_vs(const void* data, uint32 size) override;

		// Texture
		public:
			itexture * create_depthstencil(uint32 width, uint32 height);

		// Depth Stencil
		public:


		private:
			ID3D11Device * device_;
			ID3D11DeviceContext * context_;
			IDXGISwapChain * swap_chain_;
			ID3D11RenderTargetView * render_target_view_;

			d3dtexture * depth_stencil_tex_;
			ID3D11DepthStencilView * depth_stencil_view_;

			client::iwindow * window_;
		};
	}
}